import { getList } from '@/services/orgStructure';

const OrgStructureModel = {
  namespace: 'orgStructure',
  state: {
    data: {},
  },
  effects: {
    *fetch(_, { call, put }) {
      const response = yield call(getList);
      yield put({
        type: 'save',
        payload: response,
      });
    },
  },
  reducers: {
    save(state, action) {
      return { ...state, data: action.payload.data || {} };
    },
  },
};
export default OrgStructureModel;
